package com.dmjj.login.service.impl;

import com.dmjj.common.base.LoginEntity;
import com.dmjj.login.mapper.LoginMapper;
import com.dmjj.login.service.LoginService;
import com.dmjj.login.vo.StoreVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class LoginServiceImpl implements LoginService {

    @Autowired
    private LoginMapper loginMapper;

    @Override
    public Map<String, Object> getUserInfoByNO(Integer userNo) {
        return loginMapper.getUserInfoByNO(userNo);
    }

    @Override
    public long updatePassword(LoginEntity loginEntity) {
        if (!StringUtils.isEmpty(loginEntity.getUserid()) && !StringUtils.isEmpty(loginEntity.getPassword())
                && !StringUtils.isEmpty(loginEntity.getName())){
           return loginMapper.updatePassword(loginEntity);
        }
        return 0;
    }

    @Override
    public List<Map<String, Object>> queryAllStores(LoginEntity loginEntity) {
        return loginMapper.queryAllStores(loginEntity);
    }

    @Override
    public List<Map<String, Object>> queryAllBmByStoreId(StoreVO storeVO) {
        return loginMapper.queryAllBmByStoreId(storeVO);
    }

    @Override
    public List<Map<String, Object>> queryUserByBm(StoreVO storeVO) {
        return loginMapper.queryUserByBm(storeVO);
    }

}
